<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>图片视频下载器 - 测试版</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            font-size: 14px;
            line-height: 1.5;
            color: #333;
            background: #fff;
            width: 400px;
            min-height: 500px;
            overflow-x: hidden;
        }

        .popup-container {
            display: flex;
            flex-direction: column;
            min-height: 500px;
            width: 100%;
        }

        .popup-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 16px 20px;
            background: linear-gradient(135deg, #2196F3, #1976D2);
            color: white;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }

        .header-title {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .header-title h1 {
            font-size: 18px;
            font-weight: 600;
            margin: 0;
        }

        .content {
            padding: 20px;
            flex: 1;
        }

        .test-section {
            margin-bottom: 20px;
            padding: 15px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            background: #f9f9f9;
        }

        .test-section h3 {
            margin-bottom: 10px;
            color: #2196F3;
        }

        .btn {
            background: #2196F3;
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 4px;
            cursor: pointer;
            margin: 5px;
        }

        .btn:hover {
            background: #1976D2;
        }

        .status {
            padding: 10px;
            margin: 10px 0;
            border-radius: 4px;
            background: #e3f2fd;
            border-left: 4px solid #2196F3;
        }

        .error {
            background: #ffebee;
            border-left-color: #f44336;
        }

        .success {
            background: #e8f5e8;
            border-left-color: #4caf50;
        }
    </style>
</head>

<body>
    <div class="popup-container">
        <!-- 头部 -->
        <div class="popup-header">
            <div class="header-title">
                <h1>图片视频下载器</h1>
            </div>
        </div>

        <!-- 内容 -->
        <div class="content">
            <div class="test-section">
                <h3>🎉 界面测试成功！</h3>
                <p>如果您能看到这个内容，说明基本的CSS样式已经正常工作。</p>
            </div>

            <div class="test-section">
                <h3>🔧 功能测试</h3>
                <button class="btn" onclick="testScan()">测试扫描</button>
                <button class="btn" onclick="testSettings()">测试设置</button>
                <button class="btn" onclick="testDownload()">测试下载</button>
            </div>

            <div class="test-section">
                <h3>📊 状态信息</h3>
                <div id="status" class="status">
                    等待测试...
                </div>
            </div>

            <div class="test-section">
                <h3>📋 调试信息</h3>
                <div id="debug" style="font-size: 12px; color: #666;">
                    正在加载调试信息...
                </div>
            </div>
        </div>
    </div>

    <script>
        // 简单的测试脚本
        function testScan() {
            document.getElementById('status').innerHTML = '🔍 正在扫描页面媒体...';
            document.getElementById('status').className = 'status';

            setTimeout(() => {
                document.getElementById('status').innerHTML = '✅ 扫描完成！找到 5 张图片，2 个视频';
                document.getElementById('status').className = 'status success';
            }, 2000);
        }

        function testSettings() {
            document.getElementById('status').innerHTML = '⚙️ 正在打开设置页面...';
            document.getElementById('status').className = 'status';

            setTimeout(() => {
                document.getElementById('status').innerHTML = '✅ 设置页面已打开';
                document.getElementById('status').className = 'status success';
            }, 1000);
        }

        function testDownload() {
            document.getElementById('status').innerHTML = '📥 正在测试下载功能...';
            document.getElementById('status').className = 'status';

            setTimeout(() => {
                document.getElementById('status').innerHTML = '✅ 下载功能正常';
                document.getElementById('status').className = 'status success';
            }, 1500);
        }

        // 页面加载完成后的初始化
        document.addEventListener('DOMContentLoaded', function () {
            console.log('测试页面加载完成');

            // 显示调试信息
            const debugInfo = `
                <strong>页面信息：</strong><br>
                - 窗口宽度: ${window.innerWidth}px<br>
                - 窗口高度: ${window.innerHeight}px<br>
                - 用户代理: ${navigator.userAgent}<br>
                - Chrome版本: ${navigator.userAgent.match(/Chrome\/(\d+)/)?.[1] || '未知'}<br>
                <br>
                <strong>扩展信息：</strong><br>
                - 扩展ID: ${chrome.runtime?.id || '未获取到'}<br>
                - 扩展版本: ${chrome.runtime?.getManifest?.()?.version || '未获取到'}<br>
                <br>
                <strong>时间戳：</strong> ${new Date().toLocaleString()}
            `;

            document.getElementById('debug').innerHTML = debugInfo;
            document.getElementById('status').innerHTML = '✅ 测试页面加载成功！';
            document.getElementById('status').className = 'status success';
        });

        // 错误处理
        window.addEventListener('error', function (e) {
            console.error('页面错误:', e.error);
            document.getElementById('status').innerHTML = `❌ 发生错误: ${e.message}`;
            document.getElementById('status').className = 'status error';
        });
    </script>
</body>

</html>